<!doctype html>
<html>
<head>
	<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
	<!-- // <script src="http://libs.baidu.com/jquery/1.9.0/jquery.js" type="text/javascript"></script> -->
	<script type="text/javascript" src="jquery-2.1.1.js"></script>
	<title>类数组结构</title>
</head>
<body>

<div id="book">book</div>

<script type="text/javascript">

//测试优先执行
document.addEventListener("DOMContentLoaded", function(){
	//alert(1)
}, false);

 // A fallback to window.onload, that will always work
window.addEventListener("load", function(){
	//alert(2)
}, false);

// $(document).ready(function() {
// 	// ...代码...
// })
//document ready 简写
$(function() {
	// ...代码...
})

jQuery.ready.promise = function( obj ) {
	if ( !readyList ) {
		readyList = jQuery.Deferred();
		if ( document.readyState === "complete" ) {
			// Handle it asynchronously to allow scripts the opportunity to delay ready
			setTimeout( jQuery.ready );
		} else {
			document.addEventListener( "DOMContentLoaded", completed, false );
			window.addEventListener( "load", completed, false );
		}
	}
	return readyList.promise( obj );
};


// Ensure firing before onload, maybe late but safe also for iframes
document.attachEvent( "onreadystatechange", completed );
// A fallback to window.onload, that will always work
window.attachEvent( "onload", completed );
// If IE and not a frame
// continually check to see if the document is ready
var top = false;
try {
	top = window.frameElement == null && document.documentElement;
} catch(e) {}
if ( top && top.doScroll ) {
	(function doScrollCheck() {
		if ( !jQuery.isReady ) {

			try {
				// Use the trick by Diego Perini
				// http://javascript.nwbox.com/IEContentLoaded/
				top.doScroll("left");
			} catch(e) {
				return setTimeout( doScrollCheck, 50 );
			}

			// detach all dom ready events
			detach();

			// and execute any waiting functions
			jQuery.ready();
		}
	})();
}


// $(document).load(function() {
// 	// ...代码...
// })


</script>
</body>
</html>